//
//  RegistViewController.m
//  LoninAndRegist
//
//  Created by dlios on 15-3-7.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "RegistViewController.h"

@interface RegistViewController ()

@end

@implementation RegistViewController
-(void)dealloc
{
    [_nameRegistLabel release];
    [_nameRegistTextField release];
    [_nameTooRegistLabel release];
    [_nameTooRegistTextField release];
    [_passwordRegistLabel release];
    [_passwordRegistTextField release];
    [_emaildTooRegistTextField release];
    [_emailTooRegistLabel release];
    [_telephoneLabel release];
    [_telephoneTextField release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"注  册";
    
    self.nameRegistLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 50, 80, 30)];
    self.nameRegistLabel.text = @" 用户名:";
    [self.view addSubview:self.nameRegistLabel];
    
    
    self.nameRegistTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.nameRegistLabel.frame.origin.x + self.nameRegistLabel.frame.size.width + 15, self.nameRegistLabel.frame.origin.y, 200, 30)];
    [self.nameRegistTextField.layer setCornerRadius:5];
    [self.nameRegistTextField.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.nameRegistTextField.layer setBorderWidth:0.3];
    self.nameRegistTextField.placeholder = @"           请输入用户名";
    self.nameRegistTextField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:self.nameRegistTextField];
    
    self.passwordRegistLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameRegistLabel.frame.origin.x, self.nameRegistLabel.frame.origin.y + self.nameRegistLabel.frame.size.height + 50, self.nameRegistLabel.frame.size.width, self.nameRegistLabel.frame.size.height)];
    self.passwordRegistLabel.text = @"密   码:";
    [self.view addSubview:self.passwordRegistLabel];
    
    self.passwordRegistTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.nameRegistTextField.frame.origin.x, self.nameRegistTextField.frame.origin.y + self.nameRegistTextField.frame.size.height + 50, self.nameRegistTextField.frame.size.width, self.nameRegistTextField.frame.size.height)];
    [self.passwordRegistTextField.layer setCornerRadius:5];
    [self.passwordRegistTextField.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.passwordRegistTextField.layer setBorderWidth:0.3];
    self.passwordRegistTextField.placeholder = @"             请输入密码";
    self.passwordRegistTextField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:self.passwordRegistTextField];
    
    
    self.nameTooRegistLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameRegistLabel.frame.origin.x, self.passwordRegistLabel.frame.origin.y + self.passwordRegistLabel.frame.size.height + 50, self.nameRegistLabel.frame.size.width, self.nameRegistLabel.frame.size.height)];
    self.nameTooRegistLabel.text = @"确认密码:";
    [self.view addSubview:self.nameTooRegistLabel];
    
    self.nameTooRegistTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.nameRegistTextField.frame.origin.x, self.passwordRegistTextField.frame.origin.y + self.passwordRegistTextField.frame.size.height + 50, self.nameRegistTextField.frame.size.width, self.nameRegistTextField.frame.size.height)];
    [self.nameTooRegistTextField.layer setCornerRadius:5];
    [self.nameTooRegistTextField.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.nameTooRegistTextField.layer setBorderWidth:0.3];
    self.nameTooRegistTextField.placeholder = @"           再次输入密码";
    self.nameTooRegistTextField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:self.nameTooRegistTextField];
    
    self.emailTooRegistLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameRegistLabel.frame.origin.x, self.nameTooRegistLabel.frame.origin.y + self.nameTooRegistLabel.frame.size.height + 50, self.nameRegistLabel.frame.size.width, self.nameRegistLabel.frame.size.height)];
    self.emailTooRegistLabel.text = @"邮   箱:";
    [self.view addSubview:self.emailTooRegistLabel];
    
    self.emaildTooRegistTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.nameRegistTextField.frame.origin.x, self.nameTooRegistTextField.frame.origin.y + self.nameTooRegistTextField.frame.size.height + 50, self.nameRegistTextField.frame.size.width, self.nameRegistTextField.frame.size.height)];
    [self.emaildTooRegistTextField.layer setCornerRadius:5];
    [self.emaildTooRegistTextField.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.emaildTooRegistTextField.layer setBorderWidth:0.3];
    self.emaildTooRegistTextField.placeholder = @"             请输入邮箱";
    self.emaildTooRegistTextField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:self.emaildTooRegistTextField];
    
    
    self.telephoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.nameRegistLabel.frame.origin.x,self.emailTooRegistLabel.frame.origin.y + self.emailTooRegistLabel.frame.size.height + 50, self.nameRegistLabel.frame.size.width, self.nameRegistLabel.frame.size.height)];
    self.telephoneLabel.text = @"联系方式:";
    [self.view addSubview:self.telephoneLabel];
    
    
    self.telephoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.nameRegistTextField.frame.origin.x, self.emaildTooRegistTextField.frame.origin.y + self.emaildTooRegistTextField.frame.size.height + 50, self.nameRegistTextField.frame.size.width, self.nameRegistTextField.frame.size.height)];
    [self.telephoneTextField.layer setCornerRadius:5];
    [self.telephoneTextField.layer setBorderColor:[UIColor lightGrayColor].CGColor];
    [self.telephoneTextField.layer setBorderWidth:0.3];
    self.telephoneTextField.placeholder = @"        请输入联系方式";
    self.telephoneTextField.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:self.telephoneTextField];
    
    self.sureButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.sureButton.frame = CGRectMake(self.telephoneLabel.frame.origin.x + 20, self.telephoneLabel.frame.origin.y +self.telephoneLabel.frame.size.height + 70, 85, 30);
    //self.sureButton.backgroundColor = [UIColor blackColor];
    [self.sureButton setBackgroundImage:[UIImage imageNamed:@"shake_prize_phone@2x.png"] forState:UIControlStateNormal];
    [self.sureButton.layer setCornerRadius:5];
    [self.sureButton setTitle:@"确  认" forState:UIControlStateNormal];
    [self.view addSubview:self.sureButton];
    [self.sureButton addTarget:self action:@selector(sureAction:) forControlEvents:UIControlEventTouchUpInside];
    
    self.cancleButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.cancleButton.frame = CGRectMake(self.sureButton.frame.origin.x + self.sureButton.frame.size.width + 75, self.sureButton.frame.origin.y, 85, 30);
    //self.cancleButton.backgroundColor = [UIColor blackColor];
    [self.cancleButton setBackgroundImage:[UIImage imageNamed:@"shake_prize_phone@2x.png"] forState:UIControlStateNormal];
    [self.cancleButton.layer setCornerRadius:5];
    [self.cancleButton setTitle:@"取  消" forState:UIControlStateNormal];
    [self.view addSubview:self.cancleButton];
    [self.cancleButton addTarget:self action:@selector(cancleAction:) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(blockAction:)];
    
}

//确定按钮事件
-(void)sureAction:(UIButton *)button
{
    NSLog(@"注册成功");
}

-(void)blockAction:(UIBarButtonItem *)barButton
{
    [self.navigationController popViewControllerAnimated:YES];
    
}

//取消按钮事件
-(void)cancleAction:(UIButton *)button
{
    NSLog(@"取消成功");
    [self.navigationController popToRootViewControllerAnimated:YES];
}


//回收键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.nameRegistTextField resignFirstResponder];
    [self.passwordRegistTextField resignFirstResponder];
    [self.nameTooRegistTextField resignFirstResponder];
    [self.emaildTooRegistTextField resignFirstResponder];
    [self.telephoneTextField resignFirstResponder];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
